package light.head.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Formula;
/**
 *	园区公告
 */
@Entity
@Table
public class ParkAnnouncement implements Serializable{
		private static final long serialVersionUID = 2060982064973275234L;
		private Integer code;						//流水号
		private String title;						//标题
		private String content;						//类容
		private Date rt;							//发布时间
		private	Integer cu;							//创建人
		private Date topTime;				        //置顶时间
		private Date ct = new Date();				//创建时间
		private boolean deleted = false;			//是否删除
		
		private String cn;
		
		@Id
		@GeneratedValue(strategy = GenerationType.IDENTITY)
		@Column
		public Integer getCode() {
			return code;
		}
		@Column(length = 200)
		public String getTitle() {
			return title;
		}
		@Column(length = 10000)
		public String getContent() {
			return content;
		}
		@Temporal(TemporalType.TIMESTAMP)
		@Column
		public Date getTopTime() {
			return topTime;
		}
		@Temporal(TemporalType.TIMESTAMP)
		@Column
		public Date getRt() {
			return rt;
		}
		@Column
		public Integer getCu() {
			return cu;
		}
		@Temporal(TemporalType.TIMESTAMP)
		@Column(updatable = false, nullable = false)
		public Date getCt() {
			return ct;
		}
		@Column
		public boolean getDeleted() {
			return deleted;
		}
		
		
		@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu)")
		public String getCn() {
			return cn;
		}
		public void setCn(String cn) {
			this.cn = cn;
		}
		public void setCode(Integer code) {
			this.code = code;
		}
		public void setTitle(String title) {
			this.title = title;
		}
		public void setContent(String content) {
			this.content = content;
		}
		public void setRt(Date rt) {
			this.rt = rt;
		}
		public void setCu(Integer cu) {
			this.cu = cu;
		}
		public void setCt(Date ct) {
			this.ct = ct;
		}
		public void setDeleted(boolean deleted) {
			this.deleted = deleted;
		}
		public void setTopTime(Date topTime) {
			this.topTime = topTime;
		}
}
